<?php
ini_set('session.gc_maxlifetime', 7200);
session_set_cookie_params(7200);
session_start();
if((isset($_SESSION['user']['admin']) && !empty($_SESSION['user']['admin']) )){

  $t_data = explode(',',$_POST['data'],2);
  $data = urldecode($t_data[1]);
  $filename = $_POST['filename'];
  
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Content-Length: " . strlen($data));
  header("Content-type: text/x-csv");
  header("Content-Disposition: attachment; filename=".$filename);
  echo $data;
}
